using CfgTable;
using IQIGame.Onigao.Framework;
using IQIGame.Onigao.Game;
using UnityEngine;

namespace IQIGame.Onigao.GamePlay
{
    public class UIN_MapQuestRewardItem : UIBaseNode
    {
        #region Template Generate,don't modify

        protected class UIB_UIN_MapQuestRewardItem
        {
            public GameObject commonItem { protected set; get; }
            public ExText text { protected set; get; }

            public virtual void InitBinding(ObjectBinding __binding)
            {
                __binding.TryGetVariableValue<GameObject>("commonItem", out var __tbv0);
                commonItem = __tbv0;
                __binding.TryGetVariableValue<ExText>("text", out var __tbv1);
                text = __tbv1;
            }
        }

        #endregion Template Generate,don't modify

        #region fields

        private UIN_OneItem _item;

        #endregion

        #region properties

        protected UIB_UIN_MapQuestRewardItem ui { get; set; }

        #endregion properties

        protected override void BeforeInit()
        {
            ui = new UIB_UIN_MapQuestRewardItem();
            ui.InitBinding(csObjBind);
        }

        protected override void OnInit()
        {
            _item = InitChildNode<UIN_OneItem>(ui.commonItem);
        }

        protected override void OnShow()
        {

        }

        protected override void OnHide()
        {

        }

        protected override void OnDispose()
        {
        }

        public void Refresh(CfgItem itemCfg, int itemNum)
        {
            _item.Show(itemCfg);
            ui.text.text = itemNum.ToString();
        }
    }
}